home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / TUTOR.ZIP / DEMO3.ASM < prev    next >
Assembly Source File  |  1995-01-28  |  3KB  |  72 lines

  1. start: mov   ds,cs                   ;data segment = code segment
  2.     mov     ax,3                    ;reset text mode =
  3.     int     10h                     ;clear the screen.
  4.     call    cursof                  ;turn off the cursor
  5.     mov     es,0b800h               ;text mode video segment
  6.     mov     ah,1                    ;medium blue
  7.     mov     di,>s0                  ;list 7 medium colors
  8.     mov     si,844                  ;video location to start diz2
  9.     mov     cx,7                    ;display 7 lines
  10.     call    diz2                    ;display
  11.     mov     ah,9                    ;start bright blue on black
  12.     mov     di,>s1                  ;list 7 bright colors
  13.     mov     si,1964                 ;video location to start diz2
  14.     mov     cx,7                    ;display 7 lines
  15.     call    diz2                    ;display
  16.     mov     ah,15                   ;bright white
  17.     mov     cx,1                    ;display 1 line
  18.     mov     di,>s2                  ;exit message
  19.     mov     si,0                    ;display top left
  20.     call    diz2                    ;do it
  21.     mov     ah,0                    ;await key press
  22.     int     16h                     ;keyboard
  23.     cmp     ah,1                    ;Esc key
  24.     jz      exit                    ;if so, go to exit
  25.     jmp     start                   ;start all over
  26.  
  27. diz2: mov    al,[di]                 ;get character to display
  28.     inc     di                      ;next one
  29.     cmp     al,0                    ;test for zero end of string
  30.     jz      diz3                    ;if so, go to diz3
  31.     mov     es:[si],ax              ;display ASCII char.+ attribute
  32.     add     si,2                    ;next video mem address
  33.     jmp     diz2                    ;continue
  34. diz3: inc    ah                      ;next color
  35.     add     si,98                   ;next video mem to display
  36.     loop    diz2                    ;display 7 lines bright colors
  37.     ret                             ;return to next after call
  38.  
  39. exit: mov    ax,3                    ;reset text mode video
  40.     int     10h                     ;also turns cursor ON
  41.     mov     ax,4c00h                ;exit instruction
  42.     int     21h                     ;return to DOS> prompt
  43.  
  44. s0:
  45. db  'This is medium blue    on black',0
  46. db  'This is medium green   on black',0
  47. db  'This is medium cyan    on black',0
  48. db  'This is medium red     on black',0
  49. db  'This is medium magenta on black',0
  50. db  'This is medium orange  on black',0
  51. db  'This is medium white   on black',0
  52. s1:
  53. db  'This is bright blue    on black',0
  54. db  'This is bright green   on black',0
  55. db  'This is bright cyan    on black',0
  56. db  'This is bright red     on black',0
  57. db  'This is bright magenta on black',0
  58. db  'This is bright yellow  on black',0
  59. db  'This is bright white   on black',0
  60. s2: db 'Esc to exit',0
  61.  
  62. curson: mov  ah,1                    ;set cursor type
  63.     mov     cx,0607h                ;cursor type
  64.     int     10h                     ;do it
  65.     mov     dx,0                    ;cursor position
  66.     jmp     >c1                     ;> = forward jump
  67. cursof: mov  dx,1900h                ;cursor out of view on text
  68. c1:  mov     ah,2                    ;set cursor position
  69.     mov     bh,0                    ;page zero in text mode
  70.     int     10h                     ;do it
  71.     ret                             ;return to call+next instruct.
  72.